package com.yxjx.duoxue.datamodel.school;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.yxjx.duoxue.datamodel.DMObject;
import com.yxjx.duoxue.utils.UIHelper;

/**
 * 校区环境
 *
 * @author zhangxs
 * @date 2015年2月6日
 *
 */
public class SchoolDetailEnvironmentDTS extends DMObject implements Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = -301175970811768156L;
	// private Integer schoolId = -1;
    // 学校面积
    private String envArea = "";
    // 教学设施
    private String envFacilities = "";
    // 场所类型
    private String envType = "";
    // 卫生状况
    private String envHealth = "";
    // 装修程度
    private String envFitment = "";
    // 家长休息区
    private String envParentRest = "";
    // 茶水间
    private String envPantry;

    public String getEnvArea() {
        return envArea;
    }

    public void setEnvArea(String envArea) {
        this.envArea = envArea;
    }

    public String getEnvFacilities() {
        return envFacilities;
    }

    public void setEnvFacilities(String envFacilities) {
        this.envFacilities = envFacilities;
    }

    public String getEnvType() {
        return envType;
    }

    public void setEnvType(String envType) {
        this.envType = envType;
    }

    public String getEnvHealth() {
        return envHealth;
    }

    public void setEnvHealth(String envHealth) {
        this.envHealth = envHealth;
    }

    public String getEnvFitment() {
        return envFitment;
    }

    public void setEnvFitment(String envFitment) {
        this.envFitment = envFitment;
    }

    public String getEnvParentRest() {
        return envParentRest;
    }

    public void setEnvParentRest(String envParentRest) {
        this.envParentRest = envParentRest;
    }

    public String getEnvPantry() {
        return envPantry;
    }

    public void setEnvPantry(String envPantry) {
        this.envPantry = envPantry;
    }

    @Override
    public String toString() {
        return "{\"envArea\":\"" + envArea + "\", \"envFacilities\":\"" + envFacilities + "\", \"envType\":\"" + envType + "\", \"envHealth\":\"" + envHealth
                + "\", \"envFitment\":\"" + envFitment + "\", \"envParentRest\":\"" + envParentRest + "\", \"envPantry\":\"" + envPantry + "\"}";
    }
    
    public static SchoolDetailEnvironmentDTS from(String str) {
    	if (UIHelper.isEmpty(str)) {
    		return null;
    	}
    	try {
			JSONObject jo = new JSONObject(str);
			SchoolDetailEnvironmentDTS item = new SchoolDetailEnvironmentDTS();
			item.setEnvArea(castString(jo,"envArea"));
			item.setEnvFacilities(castString(jo,"envFacilities"));
			item.setEnvFitment(castString(jo,"envFitment"));
			item.setEnvHealth(castString(jo,"envHealth"));
			item.setEnvPantry(castString(jo,"envPantry"));
			item.setEnvParentRest(castString(jo,"envParentRest"));
			item.setEnvType(castString(jo,"envType"));
			return item;
		} catch (JSONException e) {
			e.printStackTrace();
			return null;
		}
    }
    
    
}